Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RANS] QSVMS Expansion Step 1 - Add Constitutive Law Support #7949

Merged
merged 11 commits into from
Dec 15, 2020

Conversation

sunethwarna
Copy link
Member

Description
This is the first step towards expanding RANS to support QSVMS (And all other stabilization methods if requred). This introduces templated RansConstitutiveLawExtension which can be used to extend easily FluidConstitutiveLaw just by providing the type of it as a template argument.

Changelog

  • Adds RansConstitutiveLawExtension
  • Adds RansNewtonian2DLaw as used example
  • Adds RansNewtonian3DLaw as used example

@sunethwarna sunethwarna self-assigned this Dec 10, 2020
@sunethwarna sunethwarna changed the title [RANS] QSVMSExpansion Step 1 - Add Constitutive Law Support [RANS] QSVMS Expansion Step 1 - Add Constitutive Law Support Dec 10, 2020
@sunethwarna sunethwarna requested a review from a team as a code owner December 10, 2020 11:54
Copy link
Member

@rubenzorrilla rubenzorrilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Long story short, we need this to customize the effective viscosity calculation but keeping the rest of the constitutive law ¿right?. Honestly, I'm not very positive about introducing a template argument in the constitutive law after the experience of the mechanical ones.

In this regard, I note that we are facing a very similar issue with the artificial magnitudes (@pau-mar @RiccardoRossi). So far we decided to duplicate the constitutive law, which is without discussion a temporary solution.

I want to confirm that this is the problematic and to better discuss it before merging.

@sunethwarna
Copy link
Member Author

Long story short, we need this to customize the effective viscosity calculation but keeping the rest of the constitutive law ¿right?.

This is exactly what I want. I am open to suggestions. This was the only way i found which is easier to look at, extend and manage FluidConstitutiveLaws. Constitutive laws are so complicated, and has lots of elements containers assigned to them, and I don't know how to manage them if we make duplicates everywhere :/

I want to confirm that this is the problematic and to better discuss it before merging.

I agree. Even ConstitutiveLaw::Parameters are also kind of complicated, and I don't totally get the signature of the ConstitutiveLaw::CalculateValue also. I would like to hear all the opinions :)

@RiccardoRossi
Copy link
Member

you can get documentation of the CL in the wiki. In my opinion using the CL is a must...

@sunethwarna
Copy link
Member Author

@RiccardoRossi thanks :).... A small question, I'm just curious, why does ConstitutiveLaw::CalculateValue take output value as a reference and as well as have the return type of the same? (In the followgin takes double& and returns a double as well.

virtual double& CalculateValue(Parameters& rParameterValues, const Variable<double>& rThisVariable, double& rValue);

Copy link
Member

@rubenzorrilla rubenzorrilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But why don't deriving them from the standard newtonian laws? At the end we just need to override the effective viscosity calculation method and enhance the check one to be sure that the TURBULENT_VISCOSITY is in the nodal data.

@sunethwarna
Copy link
Member Author

sunethwarna commented Dec 13, 2020

Then its gonna be same as the previous approach, (The template paramter was made the base class) I thought that is what you wanted to avoid, have dependencies which makes developement harder.

Previously what I had was something like this

template<class TBaseClassType>
class RansConstitutiveLaw : public TBaseClassType
{
protected:
      // overriding the GetEffectiveViscosityMethod
};

template class RansConstitutiveLaw<Newtonian2DLaw>;

And proposed deriving also will have the same (apart from the template argument)

class RansConstitutive2DLaw : public Newtonian2DLaw
{
protected:
      // overriding the GetEffectiveViscosityMethod
};

I dont see much difference in two methods

  1. 1st method will only require RansConstitutiveLaw class (only two files) - less room for coding errors
  2. 2nd method will require two classes 'RansConstitutive2DLawandRansConstitutive3DLaw` (needs 4 files) - more room for coding errors

What do you think? (Thats why recreated the whole laws from scratch so it can be decoupled for furture developements and expansions - current state of this PR)

@rubenzorrilla
Copy link
Member

The point is that I can't foresee so much room for further developments and expansions for a Newtonian law. The idea of method 2 is precisely that, avoid the template argument. Note that as it is right now it requires 4 files but only one method override, which can be eventually implemented in an external utility. Also note that the constitutive laws in the FluidDynamicsApplication could be eventually templated with the dimension. This is not done yet because of legacy reasons (some of the non-Newtonian constitutive models have no 2D version yet). By doing so we will end up with a two files implementation as option one.

@sunethwarna
Copy link
Member Author

@rubenzorrilla Done. Could you have a look?

sunethwarna and others added 2 commits December 14, 2020 09:11
…n_2d_law.cpp

Co-authored-by: Rubén Zorrilla <rubenzorrillamartinez@hotmail.com>
…n_2d_law.cpp

Co-authored-by: Rubén Zorrilla <rubenzorrillamartinez@hotmail.com>
/**
* Destructor.
*/
~RansNewtonian2DLaw() override;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
~RansNewtonian2DLaw() override;
~RansNewtonian2DLaw();

Copy link
Member

@rubenzorrilla rubenzorrilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few minor comments.

sunethwarna and others added 4 commits December 14, 2020 09:15
…n_3d_law.cpp

Co-authored-by: Rubén Zorrilla <rubenzorrillamartinez@hotmail.com>
…n_3d_law.cpp

Co-authored-by: Rubén Zorrilla <rubenzorrillamartinez@hotmail.com>
@sunethwarna
Copy link
Member Author

Hi @rubenzorrilla , I addressed all of your comments. Could you have a look?

@sunethwarna sunethwarna merged commit fe06df3 into master Dec 15, 2020
@sunethwarna sunethwarna deleted the rans/qs_vms/add_constitutive_laws branch December 15, 2020 12:34
@sunethwarna
Copy link
Member Author

thanks @rubenzorrilla :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants